#!/usr/bin/env bash

set -e

cd "$(dirname "$0")/.."

if [[ -n "$1" ]]; then
  LOCAL_GO="$1"
  shift
else
  LOCAL_GO=../cloudflare-go
fi

echo "==> Linking with local directory"
go mod tidy -e
go mod edit -replace github.com/cloudflare/cloudflare-go/v6="$LOCAL_GO"
